using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using EventAbstractionAPI.RuleEngine;
using System.Diagnostics;

namespace WindowsApplication
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>

    public partial class Window1 : System.Windows.Window
    {

        public Window1()
        {
            InitializeComponent();

            EventLoop c = new EventLoop();
            
            //we register a complex event with the event buffer so that it can translate it to a single event.
            //Triple Click is the name of the complex event that will be referenced/used from r2ml rules.
            //TimeSpan is used to expire the first click so that it can be recognised if the double click times out.
            //Note that the .NET framework will never have two Click events occur one after the other as other events
            //  will interupt the sequence. In the future this API will likely account for this with wildcards but
            //  for now we are filtering most other events so that events we are interested in are in sequence.
            //Limiation: only 2 events can currently be made into a complex event. In the future this will be resolved
            //  but it can be worked around as demonstrated by this example which could have been done using 3 click events.

            c.EventBuffer.Register(new SeqEvent(new TimeSpan(0, 0, 0, 4, 0), "TripleClick", "DoubleClick", "Click"));
            c.EventBuffer.Register(new SeqEvent(new TimeSpan(0, 0, 0, 2, 0), "DoubleClick","Click","Click"));
            
        }

    }
}